var t = new(require("../../../utils/http").HTTP);
getApp(), require("../../../libs/qqmap-wx-jssdk");
Page({
  data: {
    show: !1,
    currentIndex: 0,
    location: "",
    latitude: "",
    longitude: "",
    markers: [],
    listInfo: [{
      lat: "31.37324",
      lng: "120.603173"
    }, {
      lat: "31.436238",
      lng: "120.688864"
    }, {
      lat: "31.418656",
      lng: "120.570155"
    }, {
      lat: "31.451351",
      lng: "120.659208"
    }, {
      lat: "31.931698",
      lng: "118.949396"
    }, {
      lat: "31.998197",
      lng: "118.792414"
    }, {
      lat: "31.276421",
      lng: "120.538777"
    }, {
      lat: "31.479476",
      lng: "120.680909"
    }, {
      lat: "22.522604",
      lng: "113.939452"
    }]
  },
  onLoad: function (t) {
    wx.setNavigationBarTitle({
        title: t.xm,
        listId: t.listId
      }),
      this.setData({
        id: t.listId,
        title: t.xm
      }),
      this.projectShow()
  },
  projectShow: function () {
    var a = this;
    t.request({
        url: "http://localhost:3031/list",
        data: {
          arr: 2,
          id: a.data.id
        }
      }).then((function (t) {
        var e = t.data[0].plan.split(",").map((function (t) {
            return {
              plan: t
            }
          })),
          i = [];
        e.map((function (t, a) {
            i.push(Object.assign(t, {
              icon: "https://www.qlsyyun.com:3000/images/图标/空间设施.png"
            }))
          })),
          0 == t.data[0].tone ? a.setData({
            list: t.data[0],
            show: !1,
            newplan: e
          }) : a.setData({
            show: !0,
            list: t.data[0],
            newplan: e
          })
          a.setData({
            [`list.build`]:a.data.list.build.split(',')
          })
      })),
      t.request({
        url: "https://www.qlsyyun.com:3030/list",
        data: {
          arr: 1
        }
      }).then((function (t) {
        a.setData({
          otherList: t.data
        })
      })),
      this.getAddressDetail()
  },
  otherClick: function (t) {
    var a = t.currentTarget.dataset.idx,
      e = t.currentTarget.dataset.name;
    wx.setNavigationBarTitle({
        title: e
      }),
      this.setData({
        id: a,
        title: e,
        currentIndex: 0
      }),
      this.projectShow(),
      wx.pageScrollTo({
        scrollTop: 0
      })
  },
  titleClick: function (t) {
    this.setData({
      currentIndex: t.currentTarget.dataset.idx
    })
  },
  onShareAppMessage: function (t) {
    return {
      title: this.data.title,
      path: "/pages/list/listDetail/listDetail?listId=" + this.data.id + "&xm=" + this.data.title
    }
  },
  getAddressDetail: function () {
    var t = this;
    wx.getLocation({
      type: "wgs84",
      success: function (a) {
        
        var e = t.data.listInfo[t.data.id - 1].lat,
          i = t.data.listInfo[t.data.id - 1].lng,
          s = {
            id: 1,
            latitude: e,
            longitude: i,
            width: 25,
            height: 30
          },
          n = new Array;
        n.push(s),
          t.setData({
            latitude: e,
            longitude: i,
            markers: n
          })
      }
    })
  },
  calling: function () {
    "暂无" == this.data.list.iphone ? wx.showToast({
      title: "暂无联系方式",
      icon: "none",
      duration: 1e3
    }) : wx.makePhoneCall({
      phoneNumber: this.data.list.iphone,
      success: function () {
        console.log("拨打电话成功！")
      },
      fail: function () {
        console.log("拨打电话失败！")
      }
    })
  },
  reservation: function () {
    wx.navigateTo({
      url: "/pages/list/reserve/reserve?listId=" + this.data.listId + "&xm=" + this.data.title
    })
  }
});